<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../lib/OSL/layui/css/layui.css">
    <link rel="stylesheet" href="../lib/css/page/lab_appointment_manage.css">
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header">
            <span>停水停电通知信息</span>
            <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="addLab">新增通知</button>
        </div>
        <!-- 卡片区域  -->
        <div class="layui-card-body">
            <!-- 搜索区域   -->
            <form class="layui-form" id="form_search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">通知内容</label>
                    <div class="layui-input-block">
                        <input type="text" name="text" placeholder="请输入通知名称" autocomplete="off"
                            class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">通知时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="publish_time" placeholder="请输入通知时间" autocomplete="off"
                            class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class=" layui-form-label">通知状态</label>
                    <div class="layui-input-block">
                        <select class="select" name="status">
                            <option></option>
                            <option value="1">通知中</option>
                            <option value="0">已销毁</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <div style="margin-left: 10px;">
                        <button class="layui-btn btn_search" lay-submit lay-filter="formDemo">搜索</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
            <!-- //数据区 -->
            <table class="layui-table">
                <colgroup>
                    <col />
                    <col width="200px"/>
                    <col width="100px"/>
                    <col width="200px"/>
                </colgroup>
                <thead>
                    <tr>
                        <th>通知内容</th>
                        <th>通知时间</th>
                        <th>通知状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
            <!-- //分页区域 -->
            <div id="pageBox"></div>
        </div>
    </div>
    <!-- ---------------------------------------------------------------- -->

    <!-- ---------------------------------------------------------------- -->
    <script src="../lib/OSL/jquery.js"></script>
    <script src="../lib/OSL/layui/layui.all.js"></script>
    <script src="../lib/js/baseAPI.js"></script>
    <script src="../lib/js/page/notification.js"></script>
    <script src="../lib/OSL/template-web.js"></script>


     <!-- 获取所有用户数据的表格模板 -->
     <script type="text/html" id="tpl-table">
        {{each data}}
        <tr >
            {{if $value.status_or ==2}}
            <!-- <td>{{$value.id}}</td> -->
            <td style="text-align: center;">{{$value.text}}</td>
            <td>{{$value.publish_time}}</td>
            <!-- <td>{{$value.status}}</td> -->
            {{if $value.status ==1}}
            <td>
                <button type="button" class="layui-btn layui-btn-sm btn_fixUser" disabled="true"
                style="cursor:default;background-color: #166dd6;">通知中</button>
            </td>
            {{/if}}  
            {{if $value.status ==0}}  
            <td>
                <button type="button" class="layui-btn layui-btn-sm" disabled="true"
                style="cursor:default;background-color: #d9282e;">已销毁</button>
            </td>
            {{/if}}  
            <td>
                <button type="button" class="layui-btn layui-btn-sm btn_editLab" data_id="{{$value.id}}">修改</button>
                <button type="button" class="layui-btn layui-btn-danger layui-btn-sm btn_deleteLab"
                    data_id="{{$value.id}}">删除</button>
            </td>
            {{/if}}  
        </tr>
        {{/each}}
    </script>

      <!-- 新增通知dialog -->
      <script type="text/html" id="dialog_addLab">
        <form class="layui-form" id="form_addLab">
            <input type="hidden" name="status_or" value="2">
            <div class="layui-form-item">
                <label class="layui-form-label">通知内容</label>
                <div class="layui-input-block">
                    <textarea type="text" name="text" lay-verify="required" placeholder="请输入通知内容"
                        autocomplete="off" class="layui-textarea"> </textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认添加</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </script>
    <!-- //---------------------------------------------------------------- -->
    <!-- 根据id修改通知信息 -->
    <script type="text/html" id="dialog_editLab">
        <form class="layui-form" id="form_editLab" lay-filter="form_edit">
            <input type="hidden" name="id">
            <div class="layui-form-item">
                <label class="layui-form-label">通知内容</label>
                <div class="layui-input-block">
                    <textarea type="text" name="text" lay-verify="required" placeholder="请输入通知内容"
                        autocomplete="off" class="layui-textarea">{{$value.text}} </textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">通知状态</label>
                <div class="layui-input-block">
                    <select name="status" lay-verify="required">
                            <option value="1">通知中</option>
                            <option value="0">已销毁</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认修改</button>
                </div>
            </div>
        </form>
    </script>
</body>

</html>